package com.hanthink.system.service.impl.repair;

import com.hanthink.common.exception.CustomException;
import com.hanthink.common.utils.DateUtils;
import com.hanthink.common.utils.StringUtils;
import com.hanthink.system.domain.EmXflh;
import com.hanthink.system.domain.repair.RepairPlan;
import com.hanthink.system.mapper.EmXflhMapper;
import com.hanthink.system.mapper.repair.RepairPlanMapper;
import com.hanthink.system.service.IEmXflhService;
import com.hanthink.system.service.repair.IRepairPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 质量称重Service业务层处理
 * 
 * @author tzy
 * @date 2023-09-04
 */
@Service
public class RepairPlanServiceImpl implements IRepairPlanService
{
    @Autowired
    private RepairPlanMapper repairPlanMapper;

    /**
     * 查询质量称重
     * 
     * @param id 质量称重ID
     * @return 质量称重
     */
    @Override
    public RepairPlan selectRepairPlanById(Long id)
    {
        return repairPlanMapper.selectRepairPlanById(id);
    }

    /**
     * 查询质量称重列表
     * 
     * @param emQualityWeighing 质量称重
     * @return 质量称重
     */
    @Override
    public List<RepairPlan> selectRepairPlanList(RepairPlan emQualityWeighing)
    {
        return repairPlanMapper.selectRepairPlanList(emQualityWeighing);
    }

    /**
     * 新增质量称重
     * 
     * @param emQualityWeighing 质量称重
     * @return 结果
     */
    @Override
    public int insertRepairPlan(RepairPlan emQualityWeighing)
    {
        String a=emQualityWeighing.getResourcefrom();
        if(a=="WEB端"){
            emQualityWeighing.setManageragree(true);
            return repairPlanMapper.insertRepairPlan(emQualityWeighing);
        }else{
            return repairPlanMapper.insertRepairPlan(emQualityWeighing);
        }

    }

    /**
     * 修改质量称重
     * 
     * @param emQualityWeighing 质量称重
     * @return 结果
     */
    @Override
    public int updateRepairPlan(RepairPlan emQualityWeighing)
    {
        return repairPlanMapper.updateRepairPlan(emQualityWeighing);
    }

    /**
     * 批量删除质量称重
     * 
     * @param ids 需要删除的质量称重ID
     * @return 结果
     */
    @Override
    public int deleteRepairPlanByIds(Long[] ids)
    {
        return repairPlanMapper.deleteRepairPlanByIds(ids);
    }

    /**
     * 删除质量称重信息
     * 
     * @param id 质量称重ID
     * @return 结果
     */
    @Override
    public int deleteRepairPlanById(Long id)
    {
        return repairPlanMapper.deleteRepairPlanById(id);
    }




}
